package edu.xhu.behavior.controller;

import edu.xhu.behavior.service.BiliUserFollowGroupService;
import edu.xhu.behavior.service.BiliUserFollowService;
import edu.xhu.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.bouncycastle.pqc.jcajce.provider.BIKE;
import org.springframework.web.bind.annotation.*;

@Api(value = "bilibili关注管理", tags = "bilibili关注管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/follow")
public class FollowController {

    private final BiliUserFollowService biliUserFollowService;

    private final BiliUserFollowGroupService biliUserFollowGroupService;

    @GetMapping("/addFollow")
    @ApiModelProperty("关注")
    public ResponseResult<?> follow(@RequestParam("userId") Long userId) {
        return biliUserFollowService.follow(userId);
    }

    @GetMapping("/cancelFollow")
    @ApiModelProperty("取消关注")
    public ResponseResult<?> cancelFollow(@RequestParam("userId") Long userId) {
        return biliUserFollowService.cancelFollow(userId);
    }

    @GetMapping("/addGroup")
    @ApiModelProperty("新建分组")
    public ResponseResult<?> addGroup(@RequestParam("groupName") String groupName) {
        return biliUserFollowGroupService.addGroup(groupName);
    }

    @GetMapping("/delGroup")
    @ApiModelProperty("删除分组")
    public ResponseResult<?> delGroup(@RequestParam("groupId") Long groupId) {
        return biliUserFollowGroupService.delGroup(groupId);
    }

    @GetMapping("/updateGroup")
    @ApiModelProperty("修改分组名称")
    public ResponseResult<?> updateGroup(@RequestParam("groupId") Long groupId,
                                         @RequestParam("groupName") String groupName) {
        return biliUserFollowGroupService.updateGroup(groupId, groupName);
    }

    @GetMapping("/userFans")
    @ApiModelProperty("根据userId查询这个人的所有粉丝")
    public ResponseResult<?> allFans(@RequestParam("userId") Long userId) {
        return biliUserFollowService.allFans(userId);
    }

    @GetMapping("/delFans")
    @ApiModelProperty("根据userId,移除这个粉丝")
    public ResponseResult<?> delFans(@RequestParam("userId") Long userId) {
        return biliUserFollowService.delFans(userId);
    }


}
